#include <gtest/gtest.h>

#include "array/array.h"
#include "array/two_sum.h"

class ArrayTest : public ::testing::Test
{
  protected:
    void SetUp() override
    {
        // 初始化代码 (需要时)
    }
};

TEST_F(ArrayTest, TwoSumTest)
{
    int arr[] = {10, 20, 25, 30, 40, 50, 60};
    size_t first, second;

    // 测试正常情况
    EXPECT_TRUE(twoSum(arr, sizeof(arr) / sizeof(int), 65, first, second));
    EXPECT_EQ(first, 2);
    EXPECT_EQ(second, 4);

    // 测试边界情况
    EXPECT_FALSE(twoSum(arr, sizeof(arr) / sizeof(int), 1000, first, second));
}

TEST_F(ArrayTest, TwoSumBruteForceTest)
{
    int arr[] = {10, 20, 25, 30, 40, 50, 60};
    size_t first, second;

    // 测试正常情况
    EXPECT_TRUE(twoSumBruteForce(arr, sizeof(arr) / sizeof(int), 65, first, second));
    EXPECT_EQ(first, 2);
    EXPECT_EQ(second, 4);

    // 测试边界情况
    EXPECT_FALSE(twoSumBruteForce(arr, sizeof(arr) / sizeof(int), 1000, first, second));
}

TEST_F(ArrayTest, TwoSumHashTable)
{
    int arr[] = {10, 20, 25, 30, 40, 50, 60};
    size_t first, second;

    // 测试正常情况
    EXPECT_TRUE(twoSumHashTable(arr, sizeof(arr) / sizeof(int), 65, first, second));
    EXPECT_EQ(first, 2);
    EXPECT_EQ(second, 4);

    // 测试边界情况
    EXPECT_FALSE(twoSumHashTable(arr, sizeof(arr) / sizeof(int), 1000, first, second));
}